// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
-const DBus = imports.dbus;
+const Gio = imports.gi.Gio;
const Lang = imports.lang;
const Shell = imports.gi.Shell;
const Signals = imports.signals;
// The following are not the complete interfaces, just the methods we need
// (or may need in the future)
-const ModemGsmNetworkInterface = {
- name: 'org.freedesktop.ModemManager.Modem.Gsm.Network',
- methods: [
- { name: 'GetRegistrationInfo', inSignature: '', outSignature: 'uss' },
- { name: 'GetSignalQuality', inSignature: '', outSignature: 'u' }
- ],
- properties: [
- { name: 'AccessTechnology', signature: 'u', access: 'read' }
- ],
- signals: [
- { name: 'SignalQuality', inSignature: 'u' },
- { name: 'RegistrationInfo', inSignature: 'uss' }
- ]
-};
-const ModemGsmNetworkProxy = DBus.makeProxyClass(ModemGsmNetworkInterface);
-
-const ModemCdmaInterface = {
- name: 'org.freedesktop.ModemManager.Modem.Cdma',
- methods: [
- { name: 'GetSignalQuality', inSignature: '', outSignature: 'u' },
- { name: 'GetServingSystem', inSignature: '', outSignature: 'usu' }
- ],
- signals: [
- { name: 'SignalQuality', inSignature: 'u' }
- ]
-};
-const ModemCdmaProxy = DBus.makeProxyClass(ModemCdmaInterface);
+const ModemGsmNetworkInterface = <interface name="org.freedesktop.ModemManager.Modem.Gsm.Network">
+<method name="GetRegistrationInfo">
+ <arg type="u" direction="out" />
+ <arg type="s" direction="out" />
+ <arg type="s" direction="out" />
+</method>
+<method name="GetSignalQuality">
+ <arg type="u" direction="out" />
+</method>
+<property name="AccessTechnology" type="u" access="read" />
+<signal name="SignalQuality">
+ <arg type="u" direction="out" />
+</signal>
+<signal name="RegistrationInfo">
+ <arg type="u" direction="out" />
+ <arg type="s" direction="out" />
+ <arg type="s" direction="out" />
+</signal>
+</interface>;
+
+const ModemGsmNetworkProxy = Gio.DBusProxy.makeProxyWrapper(ModemGsmNetworkInterface);
+
+const ModemCdmaInterface = <interface name="org.freedesktop.ModemManager.Modem.Cdma">
+<method name="GetSignalQuality">
+ <arg type="u" direction="out" />
+</method>
+<method name="GetServingSystem">
+ <arg type="u" direction="out" />
+ <arg type="s" direction="out" />
+ <arg type="u" direction="out" />
+</method>
+<signal name="SignalQuality">
+ <arg type="u" direction="out" />
+</signal>
+</interface>;
+
+const ModemCdmaProxy = Gio.DBusProxy.makeProxyWrapper(ModemCdmaInterface);
let _providersTable;
function _getProvidersTable() {
ModemGsm.prototype = {
_init: function(path) {
- this._proxy = new ModemGsmNetworkProxy(DBus.system, 'org.freedesktop.ModemManager', path);
+ this._proxy = new ModemGsmNetworkProxy(Gio.DBus.system, 'org.freedesktop.ModemManager', path);
this.signal_quality = 0;
this.operator_name = null;
// Code is duplicated because the function have different signatures
- this._proxy.connect('SignalQuality', Lang.bind(this, function(proxy, quality) {
+ this._proxy.connectSignal('SignalQuality', Lang.bind(this, function(proxy, sender, [quality]) {
this.signal_quality = quality;
this.emit('notify::signal-quality');
}));
- this._proxy.connect('RegistrationInfo', Lang.bind(this, function(proxy, status, code, name) {
+ this._proxy.connectSignal('RegistrationInfo', Lang.bind(this, function(proxy, sender, [status, code, name]) {
this.operator_name = this._findOperatorName(name, code);
this.emit('notify::operator-name');
}));
ModemCdma.prototype = {
_init: function(path) {
- this._proxy = new ModemCdmaProxy(DBus.system, 'org.freedesktop.ModemManager', path);
+ this._proxy = new ModemCdmaProxy(Gio.DBus.system, 'org.freedesktop.ModemManager', path);
this.signal_quality = 0;
this.operator_name = null;
- this._proxy.connect('SignalQuality', Lang.bind(this, function(proxy, quality) {
- this.signal_quality = quality;
+ this._proxy.connect('SignalQuality', Lang.bind(this, function(proxy, sender, params) {
+ this.signal_quality = params[0];
this.emit('notify::signal-quality');
// receiving this signal means the device got activated
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
const Lang = imports.lang;
-const DBus = imports.dbus;
const Mainloop = imports.mainloop;
const Gio = imports.gi.Gio;
const Params = imports.misc.params;
const AUTORUN_EXPIRE_TIMEOUT_SECS = 10;
-const ConsoleKitSessionIface = {
- name: 'org.freedesktop.ConsoleKit.Session',
- methods: [{ name: 'IsActive',
- inSignature: '',
- outSignature: 'b' }],
- signals: [{ name: 'ActiveChanged',
- inSignature: 'b' }]
-};
+const ConsoleKitSessionIface = <interface name="org.freedesktop.ConsoleKit.Session">
+<method name="IsActive">
+ <arg type="b" direction="out" />
+</method>
+<signal name="ActiveChanged">
+ <arg type="b" direction="out" />
+</signal>
+</interface>;
-const ConsoleKitSessionProxy = DBus.makeProxyClass(ConsoleKitSessionIface);
+const ConsoleKitSessionProxy = Gio.DBusProxy.makeProxyWrapper(ConsoleKitSessionIface);
-const ConsoleKitManagerIface = {
- name: 'org.freedesktop.ConsoleKit.Manager',
- methods: [{ name: 'GetCurrentSession',
- inSignature: '',
- outSignature: 'o' }]
-};
+const ConsoleKitManagerIface = <interface name="org.freedesktop.ConsoleKit.Manager">
+<method name="GetCurrentSession">
+ <arg type="o" direction="out" />
+</method>
+</interface>;
-function ConsoleKitManager() {
- this._init();
-};
-
-ConsoleKitManager.prototype = {
- _init: function() {
- this.sessionActive = true;
-
- DBus.system.proxifyObject(this,
- 'org.freedesktop.ConsoleKit',
- '/org/freedesktop/ConsoleKit/Manager');
+const ConsoleKitManagerInfo = Gio.DBusInterfaceInfo.new_for_xml(ConsoleKitManagerIface);
- DBus.system.watch_name('org.freedesktop.ConsoleKit',
- false, // do not launch a name-owner if none exists
- Lang.bind(this, this._onManagerAppeared),
- Lang.bind(this, this._onManagerVanished));
- },
-
- _onManagerAppeared: function(owner) {
- this.GetCurrentSessionRemote(Lang.bind(this, this._onCurrentSession));
- },
-
- _onManagerVanished: function(oldOwner) {
- this.sessionActive = true;
- },
-
- _onCurrentSession: function(session) {
- this._ckSession = new ConsoleKitSessionProxy(DBus.system, 'org.freedesktop.ConsoleKit', session);
+function ConsoleKitManager() {
+ var self = new Gio.DBusProxy({ g_connection: Gio.DBus.system,
+ g_interface_name: ConsoleKitManagerInfo.name,
+ g_interface_info: ConsoleKitManagerInfo,
+ g_name: 'org.freedesktop.ConsoleKit',
+ g_object_path: '/org/freedesktop/ConsoleKit/Manager',
+ g_flags: (Gio.DBusProxyFlags.DO_NOT_AUTO_START |
+ Gio.DBusProxyFlags.DO_NOT_LOAD_PROPERTIES) });
+
+ self.connect('notify::g-name-owner', function() {
+ if (self.g_name_owner) {
+ self.GetCurrentSessionRemote(function([session]) {
+ self._ckSession = new ConsoleKitSessionProxy(Gio.DBus.system, 'org.freedesktop.ConsoleKit', session);
+
+ self._ckSession.connectSignal('ActiveChanged', function(object, senderName, [isActive]) {
+ self.sessionActive = isActive;
+ });
+ self._ckSession.IsActiveRemote(function([isActive]) {
+ self.sessionActive = isActive;
+ });
+ });
+ } else {
+ self.sessionActive = true;
+ }
+ });
- this._ckSession.connect
- ('ActiveChanged', Lang.bind(this, function(object, isActive) {
- this.sessionActive = isActive;
- }));
- this._ckSession.IsActiveRemote(Lang.bind(this, function(isActive) {
- this.sessionActive = isActive;
- }));
- }
-};
-DBus.proxifyPrototype(ConsoleKitManager.prototype, ConsoleKitManagerIface);
+ self.init(null);
+ return self;
+}
function AutomountManager() {
this._init();
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
const Lang = imports.lang;
-const DBus = imports.dbus;
const Gio = imports.gi.Gio;
const St = imports.gi.St;
/******************************************/
-const HotplugSnifferIface = {
- name: 'org.gnome.Shell.HotplugSniffer',
- methods: [{ name: 'SniffURI',
- inSignature: 's',
- outSignature: 'as' }]
-};
-
-const HotplugSniffer = function() {
- this._init();
-};
+const HotplugSnifferIface = <interface name="org.gnome.Shell.HotplugSniffer">
+<method name="SniffURI">
+ <arg type="s" direction="in" />
+ <arg type="as" direction="out" />
+</method>
+</interface>;
-HotplugSniffer.prototype = {
- _init: function() {
- DBus.session.proxifyObject(this,
+const HotplugSnifferProxy = Gio.DBusProxy.makeProxyWrapper(HotplugSnifferIface);
+function HotplugSniffer() {
+ return new HotplugSnifferProxy(Gio.DBus.session,
'org.gnome.Shell.HotplugSniffer',
'/org/gnome/Shell/HotplugSniffer');
- },
-};
-DBus.proxifyPrototype(HotplugSniffer.prototype, HotplugSnifferIface);
+}
function ContentTypeDiscoverer(callback) {
this._init(callback);
let root = mount.get_root();
let hotplugSniffer = new HotplugSniffer();
- hotplugSniffer.SniffURIRemote
- (root.get_uri(), DBus.CALL_FLAG_START,
- Lang.bind(this, function(contentTypes) {
+ hotplugSniffer.SniffURIRemote(root.get_uri(),
+ Lang.bind(this, function([contentTypes]) {
this._emitCallback(mount, contentTypes);
}));
}
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
-const DBus = imports.dbus;
const Clutter = imports.gi.Clutter;
const Gio = imports.gi.Gio;
const Lang = imports.lang;
};
Signals.addSignalMethods(EmptyEventSource.prototype);
-const CalendarServerIface = {
- name: 'org.gnome.Shell.CalendarServer',
- methods: [{ name: 'GetEvents',
- inSignature: 'xxb',
- outSignature: 'a(sssbxxa{sv})' }],
- signals: [{ name: 'Changed',
- inSignature: '' }]
-};
-
-const CalendarServer = function () {
- this._init();
-};
-
-CalendarServer.prototype = {
- _init: function() {
- DBus.session.proxifyObject(this, 'org.gnome.Shell.CalendarServer', '/org/gnome/Shell/CalendarServer');
- }
-};
-
-DBus.proxifyPrototype(CalendarServer.prototype, CalendarServerIface);
+const CalendarServerIface = <interface name="org.gnome.Shell.CalendarServer">
+<method name="GetEvents">
+ <arg type="x" direction="in" />
+ <arg type="x" direction="in" />
+ <arg type="b" direction="in" />
+ <arg type="a(sssbxxa{sv})" direction="out" />
+</method>
+<signal name="Changed" />
+</interface>;
+
+const CalendarServerInfo = Gio.DBusInterfaceInfo.new_for_xml(CalendarServerIface);
+
+function CalendarServer() {
+ var self = new Gio.DBusProxy({ g_connection: Gio.DBus.session,
+ g_interface_name: CalendarServerInfo.name,
+ g_interface_info: CalendarServerInfo,
+ g_name: 'org.gnome.Shell.CalendarServer',
+ g_object_path: '/org/gnome/Shell/CalendarServer',
+ g_flags: (Gio.DBusProxyFlags.DO_NOT_AUTO_START |
+ Gio.DBusProxyFlags.DO_NOT_LOAD_PROPERTIES) });
+
+ self.init(null);
+ return self;
+}
// an implementation that reads data from a session bus service
-function DBusEventSource(owner) {
- this._init(owner);
+function DBusEventSource() {
+ this._init();
}
function _datesEqual(a, b) {
DBusEventSource.prototype = {
- _init: function(owner) {
+ _init: function() {
this._resetCache();
- this._dbusProxy = new CalendarServer(owner);
- this._dbusProxy.connect('Changed', Lang.bind(this, this._onChanged));
+ this._dbusProxy = new CalendarServer();
+ this._dbusProxy.connectSignal('Changed', Lang.bind(this, this._onChanged));
- DBus.session.watch_name('org.gnome.Shell.CalendarServer',
- false, // do not launch a name-owner if none exists
- Lang.bind(this, this._onNameAppeared),
- Lang.bind(this, this._onNameVanished));
+ this._dbusProxy.connect('notify::g-name-owner', Lang.bind(this, function() {
+ if (this._dbusProxy.g_name_owner)
+ this._onNameAppeared();
+ else
+ this._onNameVanished();
+ }));
},
_resetCache: function() {
this._loadEvents(false);
},
- _onEventsReceived: function(appointments) {
+ _onEventsReceived: function([appointments]) {
let newEvents = [];
if (appointments != null) {
for (let n = 0; n < appointments.length; n++) {
_loadEvents: function(forceReload) {
if (this._curRequestBegin && this._curRequestEnd){
- let callFlags = 0;
+ let callFlags = Gio.DBusCallFlags.NO_AUTO_START;
if (forceReload)
- callFlags |= DBus.CALL_FLAG_START;
+ callFlags = Gio.DBusCallFlags.NONE;
this._dbusProxy.GetEventsRemote(this._curRequestBegin.getTime() / 1000,
this._curRequestEnd.getTime() / 1000,
forceReload,
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
-const DBus = imports.dbus;
const Gio = imports.gi.Gio;
const Mainloop = imports.mainloop;
const Meta = imports.gi.Meta;
};
}
-const PerfHelperIface = {
- name: 'org.gnome.Shell.PerfHelper',
- methods: [{ name: 'CreateWindow', inSignature: 'iibb', outSignature: '' },
- { name: 'WaitWindows', inSignature: '', outSignature: '' },
- { name: 'DestroyWindows', inSignature: '', outSignature: ''}]
-};
-
-const PerfHelper = function () {
- this._init();
-};
-
-PerfHelper.prototype = {
- _init: function() {
- DBus.session.proxifyObject(this, 'org.gnome.Shell.PerfHelper', '/org/gnome/Shell/PerfHelper');
- }
-};
-
-DBus.proxifyPrototype(PerfHelper.prototype, PerfHelperIface);
+const PerfHelperIface = <interface name="org.gnome.Shell.PerfHelper">
+<method name="CreateWindow">
+ <arg type="i" direction="in" />
+ <arg type="i" direction="in" />
+ <arg type="b" direction="in" />
+ <arg type="b" direction="in" />
+</method>
+<method name="WaitWindows" />
+<method name="DestroyWindows" />
+</interface>;
+
+var PerfHelperProxy = Gio.DBusProxy.makeProxyWrapper(PerfHelperIface);
+function PerfHelper() {
+ return new PerfHelperProxy(Gio.DBus.session, 'org.gnome.Shell.PerfHelper', '/org/gnome/Shell/PerfHelper');
+}
let _perfHelper = null;
function _getPerfHelper() {
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
const Gio = imports.gi.Gio;
-const DBus = imports.dbus;
const Lang = imports.lang;
const Mainloop = imports.mainloop;
const Shell = imports.gi.Shell;
PENDING_DISCHARGE: 6
};
-const PowerManagerInterface = {
- name: 'org.gnome.SettingsDaemon.Power',
- methods: [
- { name: 'GetDevices', inSignature: '', outSignature: 'a(susdut)' },
- { name: 'GetPrimaryDevice', inSignature: '', outSignature: '(susdut)' },
- ],
- signals: [
- { name: 'Changed', inSignature: '' },
- ],
- properties: [
- { name: 'Icon', signature: 's', access: 'read' },
- ]
-};
-let PowerManagerProxy = DBus.makeProxyClass(PowerManagerInterface);
+const PowerManagerInterface = <interface name="org.gnome.SettingsDaemon.Power">
+<method name="GetDevices">
+ <arg type="a(susdut)" direction="out" />
+</method>
+<method name="GetPrimaryDevice">
+ <arg type="(susdut)" direction="out" />
+</method>
+<signal name="Changed" />
+<property name="Icon" type="s" access="read" />
+</interface>;
+
+const PowerManagerProxy = Gio.DBusProxy.makeProxyWrapper(PowerManagerInterface);
function Indicator() {
this._init.apply(this, arguments);
_init: function() {
PanelMenu.SystemStatusButton.prototype._init.call(this, 'battery-missing');
- this._proxy = new PowerManagerProxy(DBus.session, BUS_NAME, OBJECT_PATH);
+ this._proxy = new PowerManagerProxy(Gio.DBus.session, BUS_NAME, OBJECT_PATH);
this._deviceItems = [ ];
this._hasPrimary = false;
this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
this.menu.addSettingsAction(_("Power Settings"), 'gnome-power-panel.desktop');
- this._proxy.connect('Changed', Lang.bind(this, this._devicesChanged));
+ this._proxy.connectSignal('Changed', Lang.bind(this, this._devicesChanged));
this._devicesChanged();
},
_readPrimaryDevice: function() {
- this._proxy.GetPrimaryDeviceRemote(Lang.bind(this, function(device, error) {
+ this._proxy.GetPrimaryDeviceRemote(Lang.bind(this, function(result, error) {
if (error) {
this._hasPrimary = false;
this._primaryDeviceId = null;
this._batteryItem.actor.hide();
return;
}
- let [device_id, device_type, icon, percentage, state, seconds] = device;
+ let [[device_id, device_type, icon, percentage, state, seconds]] = result;
if (device_type == UPDeviceType.BATTERY) {
this._hasPrimary = true;
let time = Math.round(seconds / 60);
},
_readOtherDevices: function() {
- this._proxy.GetDevicesRemote(Lang.bind(this, function(devices, error) {
+ this._proxy.GetDevicesRemote(Lang.bind(this, function(result, error) {
this._deviceItems.forEach(function(i) { i.destroy(); });
this._deviceItems = [];
}
let position = 0;
+ let [devices] = result;
for (let i = 0; i < devices.length; i++) {
let [device_id, device_type] = devices[i];
if (device_type == UPDeviceType.AC_POWER || device_id == this._primaryDeviceId)
},
_devicesChanged: function() {
- this._proxy.GetRemote('Icon', Lang.bind(this, function(icon, error) {
- if (icon) {
- let gicon = Gio.icon_new_for_string(icon);
- this.setGIcon(gicon);
- this.actor.show();
- } else {
- this.menu.close();
- this.actor.hide();
- }
- }));
+ let icon = this._proxy.Icon;
+ if (icon) {
+ let gicon = Gio.icon_new_for_string(icon);
+ this.setGIcon(gicon);
+ this.actor.show();
+ } else {
+ this.menu.close();
+ this.actor.hide();
+ }
this._readPrimaryDevice();
this._readOtherDevices();
}